{% extends "layout.html" %}

{% block title %}系统日志 - 股票实时AI分析系统{% endblock %}

{% block content %}
<h1 class="mb-4">系统日志</h1>

<div class="card">
    <div class="card-header">
        <div class="d-flex justify-content-between align-items-center">
            <span>最新日志记录</span>
            <button class="btn btn-sm btn-outline-secondary" id="refresh-logs">刷新</button>
        </div>
    </div>
    <div class="card-body">
        <div id="log-container" class="log-container">
            {% for log in logs %}
            <div>{{ log }}</div>
            {% endfor %}
        </div>
    </div>
</div>
{% endblock %}

{% block scripts %}
<script>
    document.addEventListener('DOMContentLoaded', function () {
        // Set up refresh button
        const refreshButton = document.getElementById('refresh-logs');
        if (refreshButton) {
            refreshButton.addEventListener('click', function () {
                window.location.reload();
            });
        }

        // Scroll to bottom on load
        const logContainer = document.getElementById('log-container');
        if (logContainer) {
            logContainer.scrollTop = logContainer.scrollHeight;
        }
    });
</script>
{% endblock %}